This folder contains the data and code to reproduce the data and figures of the sex difference analysis on GTEx thyroid data

### Data

Inside the data folder we have:
- `GTEx_thyroid_female.txt`: gene expression data for female samples that were used to generate sample-specific BONOBO networks
- `GTEx_thyroid_male.txt`: gene expression data for male samples that were used to generate sample-specific BONOBO networks
- `GTEx_thyroid_motif.tab`: a table containing the locations of the motif prior for each sample, to be used as input to PANDA
- `GTEx_thyroid_RSE.RData`: gene expression, subject phenotypes and gene information of GTEx thyroid tissue samples downloaded from Recount3
- `priors`: contains protein-protein interaction (PPI) prior and sex-specific transcription factor motif priors to be used as input to PANDA for deriving sample-specific gene regulatory networks.

### Code

In `src` we have the R code to reproduce all the analyses in the paper. 
- `bonobo_thyroid_sexDifference_GSEA.R`: limma model to identify genes that are significantly differentially regulated between males and females in thyroid from BONOBO networks, after adjusting for clinical covariates
- `GTEx_thyroid_dataPrep.R`: Data preprocessing and filtering to prepare for network construction
- `GTEx_thyroid_network_file_to_matrix`: combine individual bipartite gene regulatory networks into a single matrix where rows are network edges and columns are samples
- `GTEx_thyroid_PANDAvsBONOBO.R`: Compare between downstream analysis from individual-specific BONOBO networks and sex-specific aggregate PANDA networks
- `GTEx_thyroid_panda_gsea.R`: limma model to identify genes that are significantly differentially regulated between males and females in thyroid from sex-specific aggregare PANDA networks
- `prepare_motifFile_GTEx_thyroid.R`: make a table containing the locations of the motif prior for each sample, to be used as input to PANDA
- `volcanoPlot.R`: visualize differentially regulated genes using volcano plot

### Results 

- `BonoboPanda_GTEx_thyroid.txt`: a matrix containing gene-specific indegree of gene regulatory networks derived by BONOBO-PANDA pipeline, where rows correspond to genes in the network and columns correspond to individual samples
- `thyroid_panda_female.txt`: a matrix containing gene-specific indegree of gene regulatory networks derived by PANDA from female samples
- `thyroid_panda_male.txt`: a matrix containing gene-specific indegree of gene regulatory networks derived by PANDA from male samples

